import HttpRequest from '@/libs/axios'
import {Message} from 'iview'
import {syGet} from '@/libs/thirdtool'

const axios = new HttpRequest()
export default axios

/**
 * 查询字典列表
 * @param ids
 * @returns {*}
 */
export const Dict = (key) => {
  if (!key) {
    Message.warning('数据不允许为空')
    return
  }
  return axios.get('/dict/subByKey/' + key)
}

/**
 * 获取字典的值
 * @param ids
 * @returns {*}
 */
export const getDictVal = (key, val) => {
  if (!key || !val) {
    Message.warning('数据不允许为空')
    return
  }
  var dict = syGet('/dict/detail?key=' + val + '&pkey=' + key)
  return dict.name
}
